#include <bits/stdc++.h>
using namespace std;

// #define ONLINE_JUDGE

#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

typedef long long LL;

const int N = 1e5+50;

int n;
int a[N], b[N];

int x, y;

int main(int argc, char const *argv[])
{
	int t;
	scanf("%d", &n);
	for (int i=0; i<n; ++i)
		scanf("%d", &a[i]);
	for (int i=0; i<n; ++i)
		scanf("%d", &b[i]);
	for (int i=0; i<n; ++i)
	{
		if (a[i] == 0 && b[i] == 1)
			++y;
		else if (a[i] == 1 && b[i] == 0)
			++x;
	}
	// dbg(x, y);
	if (x == 0){
		puts("-1");
		return 0;
	}
	int ans = (y + x) / x;
	
		printf("%d\n", ans);
	return 0;
}